$(function(){
	$("#saveUserInfo").click(function(){
		var staffCode = $("#staffCode").val();
		if(!staffCode){
			eDialog.alert('请填写登陆账号');
			return;
		}
		var staffName = $("#staffName").val();
		if(!staffName){
			eDialog.alert('请填写用户姓名');
			return;
		}
		var staffMobile = $("#staffMobile").val();
		if(!staffMobile){
			eDialog.alert('请填写用户手机号码');
			return;
		}
		var roleId = "";
		$("input[name='role']").each(function(){
			if($(this).get(0).checked){
				var ele = $(this).get(0);
				roleId+=$(ele).val()+",";
			}
		});
		$.ajax({
			url: GLOBAL.WEBROOT+"/systemStaff/updateStaff",
	        data:{
	        	staffCode:staffCode,
	        	staffName:staffName,
	        	staffMobile:staffMobile,
	        	roleId:roleId,
	        	id:$("#userId").val()
	        },
	        type:"post",
	        dataType:"json",
	        async:true,
		    cache:true,
	        success: function (data){
	        	window.top.location.href =WEB_ROOT+"/systemStaff/init";
	        },
	        error:function(XMLHttpRequest, textStatus, errorThrown){
	        	
	        }
		});
	});
});